package com.demo.comsumer.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
import org.springframework.stereotype.Component;

/**
 * 处理mqtt的具体消息
 */
@Slf4j
@Component
public class MqttMsgConsumer implements MessageHandler {
    @Override
    public void handleMessage(Message<?> message) throws MessagingException {
        String msg = message.getPayload().toString();
        //log.info("mqtt消费 " + message.getHeaders().get("mqtt_receivedTopic") + " " + msg);
        log.info("mqtt消费 " + message.getHeaders().get("mqtt_receivedTopic") + " " + msg);
    }
}
